package lab02.test20;

import java.util.Scanner;

public class Test20 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个含有数字和字符的字符串：");
        String a = sc.next();

        //用a.toCharArray()方法将字符串中的每个字符放在数组中
        char[] arr = a.toCharArray();
        for (int i = 0;i <= a.length()-1; i ++){
            if (arr[i] >= '0'&&arr[i] <= '9'){
                System.out.print(arr[i]);
            }

        }
    }
}
